//
//  commentsMode.m
//  HaHa
//
//  Created by 元虎的mac on 15/9/22.
//  Copyright (c) 2015年 吉亚平. All rights reserved.
//

#import "commentsMode.h"

@implementation commentsMode

//内涵段子字典赋值
+ (commentsMode *)setHModeWithDic:(NSDictionary *)Dic{
    commentsMode *mode = [[commentsMode alloc] init];
    mode.commentPhotoUrl = [Dic objectForKey:@"avatar_url"];
    mode.commentName = [Dic objectForKey:@"user_name"];
    mode.commentContent = [Dic objectForKey:@"text"];
    NSString *time = [Dic objectForKey:@"create_time"];
    mode.publishedTime = [mode Retrun:time];
    return mode;
}

- (NSString *)Retrun:(NSString *)str{
        NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
        formatter.timeZone = [NSTimeZone timeZoneWithName:@"shanghai"];
        [formatter setDateStyle:NSDateFormatterMediumStyle];
        [formatter setTimeStyle:NSDateFormatterShortStyle];
        [formatter setDateFormat:@"MM-dd HH:mm"];
        NSDate* date = [NSDate dateWithTimeIntervalSince1970:[str doubleValue]];
        NSString* dateString = [formatter stringFromDate:date];
    return dateString;
}



@end
